package org.example.Tomcat.Handler;

import org.example.Tomcat.Request;

import java.nio.ByteBuffer;

/**
 * @description:
 * @author: farprt
 * @create: 2023-02-13 16:45
 **/
public class MethodHandler implements BaseRequestHandler {


    @Override
    public int order() {
        return 0;
    }

    @Override
    public void read(ByteBuffer byteBuffer,Request request) {
        StringBuilder method = new StringBuilder();
        char c;
        while ((c = (char)byteBuffer.get()) != ' '){
            method.append(c);
        }
        request.setMethod(method.toString());
    }
}